<?php require_once('Connections/STN.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_STN, $STN);
$query_RSPostagens = "select pos.POS_TITULO,pos.POS_CODIGO, pos.POS_DATA, pos.POS_TEXTO FROM tb_postagens pos WHERE pos.POS_PUBLICA='2' ORDER BY pos.POS_DATA desc limit 4,3;";
$RSPostagens = mysql_query($query_RSPostagens, $STN) or die(mysql_error());
$row_RSPostagens = mysql_fetch_assoc($RSPostagens);
$totalRows_RSPostagens = mysql_num_rows($RSPostagens);

mysql_select_db($database_STN, $STN);
$query_RSvideo = "SELECT VID_CODIGO, VID_URL FROM tb_videos LIMIT 6;";
$RSvideo = mysql_query($query_RSvideo, $STN) or die(mysql_error());
$row_RSvideo = mysql_fetch_assoc($RSvideo);
$totalRows_RSvideo = mysql_num_rows($RSvideo);

mysql_select_db($database_STN, $STN);
$query_RSanimacao = "SELECT pos.POS_TITULO,pos.POS_CODIGO, ftp.FTP_CODIGO FROM tb_postagens pos LEFT JOIN tb_fotos_postagens ftp ON(ftp.FTP_POS_CODIGO=pos.POS_CODIGO) WHERE pos.POS_PUBLICA='2' ORDER BY pos.POS_DATA desc LIMIT 4;";
$RSanimacao = mysql_query($query_RSanimacao, $STN) or die(mysql_error());
$row_RSanimacao = mysql_fetch_assoc($RSanimacao);
$totalRows_RSanimacao = mysql_num_rows($RSanimacao);

//limitar tamanho do texto
function limitarTexto($texto)
{
 
$texto = substr($texto, 0, strrpos(substr($texto, 0, 40), ' ')) . '...';
 
   return $texto;
 
}

//conversor de data
	function bancobr($databanco){
		$mes = substr($databanco, 5, 2);
		$dia = substr($databanco, 8, 2);
		$databr = $dia . "/" . $mes;
		return $databr;
	}
?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>A Sala do Tio Naldinho</title>


<link rel="stylesheet" href="css/style.css" type="text/css" >

<script type="text/javascript" src="js/jquery.js"></script>

<script type="text/javascript" src="js/banner.js"></script>

<script type="text/javascript" src="banner/jsbanner.js"></script>

<script type="text/javascript" src="js/jquery.cycle.all.js"></script>

<link rel="stylesheet" href="banner/stylebanner.css">

<!--janela modal-->
<script type="text/javascript">


$(document).ready(function() {	

	$('a[name=modal]').click(function(e) {
		e.preventDefault();
		
		var id = $(this).attr('href');
	
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		$('#mask').css({'width':maskWidth,'height':maskHeight});

		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		$(id).fadeIn(2000); 
	
	});
	
	$('.window .close').click(function (e) {
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
});

</script>

<!--fim da janela de contato-->


<script type="text/javascript" src="js/jcarousellite.js"></script>

<script type="text/javascript">

$(function(){

   $(".carosel").jCarouselLite({

     btnNext: ".next",

     btnPrev: ".prev",

     visible: 3,

     auto: 0,

     speed: 1000

   })

})
</script>

<script type="text/javascript" src="colorbox/jquery.colorbox.js"></script>

<link rel="stylesheet" href="colorbox.css" type="text/css" />

<script>
		$(document).ready(function(){
			//Examples of how to assign the ColorBox event to elements
			$(".group1").colorbox({rel:'group1'});
			$(".group2").colorbox({rel:'group2', transition:"fade"});
			$(".group3").colorbox({rel:'group3', transition:"none", width:"75%", height:"75%"});
			$(".group4").colorbox({rel:'group4', slideshow:true});
			$(".ajax").colorbox();
			$(".youtube").colorbox({iframe:true, innerWidth:425, innerHeight:344});
			$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
			$(".inline").colorbox({inline:true, width:"50%"});
			$(".callbacks").colorbox({
				onOpen:function(){ alert('onOpen: colorbox is about to open'); },
				onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
				onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
				onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
				onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
			});
			
			//Example of preserving a JavaScript event for inline calls.
			$("#click").click(function(){ 
				$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
				return false;
			});
		});
	</script>

</head>

<body>
<!--inicio do quadro verde da logo-->
<div style="width:100%; height:250px;background:#1A2D1C;margin-left:0px;">


<div class="logo" style=" text-align:center;">



<!--div da logo-->
<img src="imagens/logo2.png" style=" margin-top: 60px;"/>

</div><!--fim da div da logo-->

</div><!--fimm do fundo verde da logo-->

<div style="width:99%; height:10px;background:#12B225;margin-left:-2px;top:250px;box-shadow:0 0 .5em #000;position:absolute;z-index:1010;">
</div><!--fim da linha com efeito da logo-->


<!--div central de todo o conteudo-->
<div class="all">

<!--inicio do menu-->
<div class="menu">
<ul class="menuul">
	<li><span><a href="index.php">IN&Iacute;CIO</a></span></li>
    <li><span><a href="sobre.php">TIO NALDINHO</a></span></li>
    <li><span><a href="#">A SALA</a></span>
    	<ul class="submenu">
        	<li><span><a href="videos.php">VIDEOS</a></span></li><br />
            <li><span><a href="documentos.php">DOCUMENTOS</a></span></li>
            <li><span><a href="albuns.php">FOTOS ANTIGAS</a></span></li>
        </ul>
    
    </li>
    <li><span><a href="#dialog2" name="modal">CONTATO</a></span></li>
</ul>

</div><!--fim do menu-->

<!--div da do formulario de busca-->
<div class="busca">
<form action="postagens.php" method="get">
<table>
<tr>
	<td>
<input type="text" name="filtro" placeholder="buscar"></td><td><button><img src="imagens/lupa.png" /></button></td>
</tr>
</table>
</form>
</div><!--fim do formulario de busca-->

<!--inicio da tabela do body-->
<table>
<tr>
	<td rowspan="2">
	<div class="menuesquerdo">
    <ul>
    	<li><span class="titulomenu"><a href="postagens.php?categoria=1">HISTORIA GERAL</a></span></li>
        <div class="bg"></div>
        <li><span><a href="postagens.php?periodo=1">Pr&eacute;-Historia</a></span></li>
        <li><span><a href="postagens.php?periodo=2">Idade-Antiga</a></span></li>
        <li><span><a href="postagens.php?periodo=3">Idade-M&eacute;dia</a></span></li>
        <li><span><a href="postagens.php?periodo=4">Idade-Moderna</a></span></li>
        <li><span><a href="postagens.php?periodo=5">Idade-Contepor&acirc;nea</a></span></li>
     </ul>
	</div>
    
    <div class="menuesquerdo2">
    <ul>
    	<li><span class="titulomenu"><a href="postagens.php?categoria=2">HISTORIA DO BRASIL</a></span></li>
        <div class="bg"></div>
        <li><span><a href="postagens.php?periodo=6">Pr&eacute;-Col&ocirc;nial</a></span></li>
        <li><span><a href="postagens.php?periodo=7">Col&ocirc;nial</a></span></li>
        <li><span><a href="postagens.php?periodo=8">Imp&eacute;rial</a></span></li>
        <li><span><a href="postagens.php?periodo=9">Rep&uacute;blica</a></span></li>
     </ul>
	</div>
    
    <div class="menuesquerdo3">
    <ul>
    	<li><span class="titulomenu"><a href="postagens.php?categoria=3">RIO GRANDE DO NORTE</a></span></li>
        <div class="bg"></div>
        <li><span><a href="postagens.php?periodo=10">Pr&eacute;-Col&ocirc;nia</a></span></li>
        <li><span><a href="postagens.php?periodo=11">Col&ocirc;nia</a></span></li>
        <li><span><a href="postagens.php?periodo=12">Imp&eacute;rio</a></span></li>
        <li><span><a href="postagens.php?periodo=13">Rep&uacute;blica</a></span></li>
     </ul>
	</div>
    </td>
    <!--coluna da animação-->
    <td>
    <div id="backanimacao"></div>
    <div id="animacao">
  
        <?php do { ?>
          <div class="slide">
            <a href="postagens2.php?id=<?php echo $row_RSanimacao['POS_CODIGO'] ?>"><img src="ADM/fotospostagem/<?php if($row_RSanimacao['FTP_CODIGO']=="") echo "0"; else  echo $row_RSanimacao['FTP_CODIGO']; ?>.jpg" width="520" height="349" /></a>
            <p><?php echo $row_RSanimacao['POS_TITULO'] ?></p>
          </div>
          <?php } while ($row_RSanimacao = mysql_fetch_assoc($RSanimacao)); ?>
   	</div><!--fim da coluna da animação-->
    
    
    <!--mostra as paginas da animação-->
    <div class="pager">
    &nbsp;
    
    </div>
    </td>
    
    <td>
    <div class="menudireito">
    <ul>
    	<li><span class="titulomenu"><a href="#">Sites e Blogs</a></span></li>
        <div class="bgdireito"></div>
        <li><span><a href="http://www.ufrn.br" target="_blank">UFRN</a></span></li>
        <li><span><a href="http://www.acasadotionaldinho.blogspot.com" target="_blank">A Casa do Tio Naldinho</a></span></li>
        <li><span><a href="http://www.history.com/" target="_blank">History Channel</a></span></li>
        <li><span><a href="http://blogdolucasmatheus.blogspot.com.br/" target="_blank">LukasMatheus</a></span></li>
        <li><span><a href="http://www.anpuh.org" target="_blank">ANPUH</a></span></li>
        <li><span><a href="http://www.cnpq.br" target="_blank">CNPq</a></span></li>
        <li><span><a href="http://www.mec.gov.br" target="_blank">MEC</a></span></li>
     </ul>
	</div>
    </td>
    </tr>
    <tr>
    <td>
    <!--coluna da tabela das psotagens-->
    <div class="postagens">
		<table width="470px" height="300px">
  			<?php do { ?>
    		<tr style="background:#1794ce;">
      			<td width="30px" rowspan="2" style="font-size:25px;font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif;color:#333;font-weight: bold;padding:10px;box-shadow:0 0 .5em #0e709d;text-shadow:0 0 .3em #fff;"><div ><?php echo bancobr($row_RSPostagens['POS_DATA']) ?></div></td>
      			<td style="font-size:20px;font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif;font-weight: bold;padding:5px;box-shadow:0 0 .5em #0e709d;"> <div><a href="postagens2.php?id=<?php echo $row_RSPostagens['POS_CODIGO'] ?>"><?php echo $row_RSPostagens['POS_TITULO'] ?></a></div></td>
      		<tr>
      			<td colspan="2" style="font-size:12px;font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif;"><div style="font-size:9px;"><?php echo limitarTexto($row_RSPostagens['POS_TEXTO']) ?></div></td>
    	</tr>
    <?php } while ($row_RSPostagens = mysql_fetch_assoc($RSPostagens)); ?>
</table>
</div>
    
    </td>
    <td>
    <div class="twitter">
<script charset="utf-8" src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
  version: 2,
  type: 'profile',
  rpp: 30,
  interval: 2000,
  width: 230,
  height: 213,
  theme: {
    shell: {
      background: '#1dad15',
      color: '#ffffff'
    },
    tweets: {
      background: '#011f02',
      color: '#ffffff',
      links: '#4aed05'
    }
  },
  features: {
    scrollbar: false,
  loop: true,
  live: true,
  hashtags: true,
  timestamp: true,
  avatars: false,
  behavior: 'default'
  }
}).render().setUser('salationaldinho').start();
</script>


</div>
    
    </td>
    </tr>
   	<!--fim da tabela-->
<tr>
<td colspan="3">
<div id="carosel">
<button class="prev"></button>
<button class="next"></button>
 <div class="carosel">

 <ul>
   <?php do { ?>
     <li><?php echo $row_RSvideo['VID_URL'] ?> </li>
     <?php } while ($row_RSvideo = mysql_fetch_assoc($RSvideo)); ?> 
 </ul>

 </div><!--fim do carosel id-->
</div><!--fim do carosel classl-->

</td>
</tr>   


</table><!--fim da tabela da body central-->
</div><!--Fim  da div central (all)-->

<div class="borderfooter">
</div>
<div class="rodape">
<!--copyrignt-->
<div class="copy">
	&copy;copyright <?php echo $programadores ?><br />
    Todos os direitos reservado.
</div>


</div>

<!--div da pagina de contato-->
<div id="boxes">
<div id="dialog2" class="window">
 <form action="?" method="post">
     <input type="text" name="nome" placeholder="Nome" size="50px" style="padding:10px;" /><br /><br />
     <input type="email" name="email" placeholder="Email" size="50px" style="padding:10px;" /><br /><br />
     <textarea style="width:350px;height:200px;"></textarea><br />
     <input type="submit" value="Enviar" onclick="window.alert('Email enviado.\n\n Obrigado.');" />
     <input type="button" value="Fechar" class="close"/>
</form>
</div>
</div>
<!-- Fim Janela Modal da pagina de contato -->
<!-- Máscara para cobrir a tela -->
  <div id="mask"></div>

</div>
<!--fim da div da mascara-->
</body>
</html>
<?php
mysql_free_result($RSPostagens);

mysql_free_result($RSvideo);

mysql_free_result($RSanimacao);
?>
